package com.mdx.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mdx.bean.LogBean;
import com.mdx.service.ILogService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * 日志
 */
@RestController
@RequestMapping("log")
public class LogController {
    @Resource
    private ILogService logService;

    //查询所有
    @RequestMapping("findAll")
    public IPage<LogBean> findAll(@RequestParam(value = "pageNO", defaultValue = "1") int pageNO,
                                  @RequestParam(value = "pageSize", defaultValue = "2") int pageSize){
        return logService.findByItem(pageNO,pageSize,null,null);
    }

    //动态条件查询
    public IPage<LogBean> findByItem(@RequestParam(value = "pageNO", defaultValue = "1") int pageNO,
                                     @RequestParam(value = "pageSize", defaultValue = "2") int pageSize,
                                     LocalDate start,LocalDate end){
        return logService.findByItem(pageNO,pageSize,start,end);
    }
}
